package model.feature;

import java.io.File;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import model.Settings;
import util.PlayerUtilities;

public class item {
	private static Map<Integer, item> featureRecords = new HashMap<Integer, item>();
	public static Map<Integer, item> getFeatureRecords() {
		return featureRecords;
	}

	public static void setFeatureRecords(Map<Integer, item> featureRecords) {
		item.featureRecords = featureRecords;
	}

	public int getId() {
		return Id;
	}

	public void setId(int id) {
		Id = id;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public double getTemperature() {
		return temperature;
	}

	public void setTemperature(double temperature) {
		this.temperature = temperature;
	}

	private int Id;
	private String date;
	private String type;
	private String image;
	private String text;
	private double temperature;
	/**
	 * @param args
	 */
	public item()
	{
		
	}
	
	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		if (new File(Settings.FEATURE_XML).exists()) {
			Object obj = PlayerUtilities.getObjectFromXMLFile(Settings.FEATURE_XML);
			if (obj != null) {
				featureRecords = (Map<Integer, item>) obj;
				
				Collection<Integer> Record = featureRecords.keySet();
				//System.out.println(Record);
				
				Iterator iterator = Record.iterator(); 
				  while (iterator.hasNext()){
					 System.out.println(iterator.next());   
				  }
				  
				  System.out.println(featureRecords.get(1).getDate());
				
			} else {
				System.out.println("Failed to read " + Settings.CONTENTS_XML);
				
			}
		}
		
		
	}

}
